*Initial recodes

drop if V4 == 1
*** Exclude Belarus, East Germany, West Germany ***
drop if V3== 1 | V3 == 5 | V3 == 6
* Rename V5 *
rename V5 newspaper
* Recode "I don't know" and "Not available" as missing for newspaper *
replace newspaper =. if newspaper > 4
* Rename V9 *
rename V9 polmeet
* Recode "I don't know" and "Not available" as missing for polmeet *
replace polmeet=. if polmeet > 4
* Rename V10 *
rename V10 contpol
* Recode "I don't know" and "Not available" as missing for contpol *
replace contpol=. if contpol > 4
* Rename V11 *
rename V11 workpart
* Recode "I don't know" and "Not available" as missing for workpart *
replace workpart=. if workpart > 4
* Rename V16*
rename V16 mdfree
* Rename V17*
rename V17 mdpart
* Rename V18*
rename V18 mdsed
* Rename V19*
rename V19 mdparel
* Rename v20* 
rename V20 mdlid
* Rename V21 *
rename V21 mdvalues
* Rename v22* 
rename V22 mdea
* Rename V23 *
rename V23 mdo
*Histogram to check distribution of responses *
histogram mdfree
histogram mdpart
histogram mdsed
histogram mdparel
histogram mdid
histogram mdlid
histogram mdvalues
histogram mdea
histogram mdo
foreach x of varlist mdfree-mdvalues {
replace `x'=. if `x'> 2
}
* Drop repeated questions *
drop V24-V39
* Rename V40 *
rename V40 dembest
replace dembest=. if dembest > 3
sum dembest
tab dembest
replace dembest=. if dembest > 3
* Rename V41 *
rename V41 demcount
* Recode demcount *
replace demcount=. if demcount > 3
* Rename V42 *
rename V42 indhr
* Recode indhr *
replace indhr=. if indhr > 4
* Rename V44 *
rename V44 leftright
* Recode leftright *
replace leftright=. if leftright > 10
* Rename V123 *
rename V123 memasc
* Recode memasc *   
replace memasc=. if memasc > 2
* Rename V124 *
rename V124 memla
* Recode memla *   
replace memla=. if memla > 2
* Rename V125 *
rename V125 mempr
* Recode mempr *   
replace mempr=. if mempr > 2
* Rename V136 *
rename V136 memmov
* Recode memmov *   
replace memmov=. if memmov > 2
histogram memmov
* Rename V145 *
rename V145 memec
* Recode memec *   
replace memec=. if memec > 2
histogram memec
* Rename V146 *
rename V146 mempa
* Recode mempa *   
replace mempa=. if mempa > 2
* Rename V147 *
rename V147 memsc
* Recode memsc *   
replace memsc=. if memsc > 2
histogram memsc
* Rename V148 *
rename V148 memtu
* Recode memtu *   
replace memtu=. if memtu > 2
histogram memtu
* Rename V157 *
rename V157 memsa
* Recode memsa *   
replace memsa=. if memsa > 2
histogram memsa
* Rename V158 *
rename V158 memro
* Recode memro *   
replace memro=. if memro > 2
histogram memro
* Rename V159 *
rename V159 memo
* Recode memo *   
replace memo=. if memo > 2
histogram memo
* Recode var173 *
rename V173 satdem
replace satdem=. if satdem > 10
* Recode Free Market Economy *
rename V181 marketright
tab marketright
replace marketright=. if marketright > 2
histogram marketright
* Recode Satisfaction with Free Market Economy *
rename V182 satmar
tab satmar
replace satmar=. if satmar > 2
histogram satmar
* Recode Personal Economic Situation (Government) *
rename V183 pesgov
tab pesgov
replace pesgov=. if pesgov > 3
histogram pesgov
* Recode Personal Economic Situation (Future) *
rename V184 pesny
replace pesny=. if pesny> 3
histogram pesny
* Recode Personal Economic Situation (Communism) *
rename V185 pescom
replace pescom=. if pescom> 3
histogram pescom
* Recode Country's Economic Situation (Government) *
rename V186 cesgov
replace cesgov=. if cesgov> 3
histogram cesgov
* Recode Country's Economic Situation (Next Year) *
rename V188 cesny
replace cesgov=. if cesny> 3
histogram cesny
* Recode Country's Economic Situation (Communism) *
rename V190 cescom
replace cescom=. if cescom> 3
histogram cescom
* Recode Income Differences Preferences *
rename V206 incdiff
replace incdiff=. if incdiff> 3
replace incdiff=. if incdiff==0
histogram incdiff
* Recode Personal Financial Situation (parents)*
rename V207 pfspar
replace pfspar=. if pfspar> 3
replace pfspar=. if pfspar==0
histogram pfspar
* Recode Personal Financial Situation (neighbours) *
rename V208 pfsnei
replace pfsnei=. if pfsnei> 3
replace pfspar=. if pfspar==0
histogram pfsnei
* Recode Speed *
rename V209 speed
replace speed=. if speed> 3
replace speed=. if speed==0
histogram speed
* Recode Government satisfaction *
rename V210 govsat
replace govsat=. if govsat > 10
* Recode Satisfaction with Communism *
rename V211 satcom
replace satcom=. if satcom > 10
histogram satcom
* Recode Communism Good Idea *
rename V216 comgi
replace comgi=. if comgi > 3
replace comgi=. if comgi==0
histogram comgi
* Recode Trust in Family *
rename V235 trustfam
replace trustfam=. if trustfam > 4
histogram trustfam
* Recode Trust in National Government *
rename V236 trustng
replace trustng=. if trustng > 4
histogram trustng
* Recode Trust in Neighbours*
rename V238 trustnei
replace trustnei=. if trustnei > 4
histogram trustnei
* Recode Trust in Linguistic Group *
rename V239 trustlg
replace trustlg=. if trustlg > 4
histogram trustlg
* Recode Trust in Mass Media *
rename V242 trustmm
replace trustmm=. if trustmm > 4
histogram trustmm
* Recode Trust in Trade Union *
rename V246 trusttu
replace trusttu=. if trusttu > 4
histogram trusttu
* Recode Trust in Work Companions *
rename V249 trustwc
replace trustwc=. if trustwc > 4
histogram trustwc
* Recode Trust in Political Parties *
rename V250 trustpp
replace trustpp=. if trustpp > 4
histogram trustpp
* Recode Trust in Government *
rename V253 trustgov
replace trustgov=. if trustgov > 4
histogram trustgov
* Recode Trust in Opposition *
rename V254 trustopp
replace trustopp=. if trustopp > 4
histogram trustopp
* Recode Trust in Parliament *
rename V255 trustpar
replace trustpar=. if trustpar > 4
histogram trustpar
* Recode Country run by interets *
rename V274 biginterests
replace biginterests=. if biginterests > 2
histogram biginterests
* Recode Elections best way to choose government *
rename V276 elections
replace elections=. if elections > 2
replace elections=. if elections == 0
tab v335
tab V335
* Recode Need parliament *
rename V277 needpar
replace needpar=. if needpar > 2
histogram needpar
* Recode Voting *
rename V278 vote
replace vote=. if vote>2
replace vote=. if vote==0
histogram vote
* Recode Need Western Development *
rename V331 needwd
histogram needwd
* Recode Consolidation of Democracy *
rename V332 consdem
replace consdem=. if consdem>2
histogram consdem
* Recode Dem Same as in West *
rename V333 samedem
replace samedem=. if samedem>2
histogram samedem
* Recode Consolidation of Democracy *
rename V334 consdemdiff
replace consdemdiff=. if consdemdiff>2
histogram consdemdiff
* Recode Democracy not accomplished *
rename V335 demna
replace demna=. if demna>2
histogram demna
* Recode Content with Democracy *
rename V340 contentdem
replace contentdem=. if contentdem>4
replace contentdem=. if contentdem==0
* Recode Parties Needed *
rename V341 partneed
replace partneed=. if partneed>2
histogram partneed
* Recode No Difference *
rename V342 nodiffpart
replace nodiffpart=. if nodiffpart>2
histogram nodiffpart
* Recode Parties Serve Leaders *
rename V344 parservl
replace parservl=. if parservl>2
histogram parservl
* Recode Change Communism *
rename V346 comch
replace comch=. if comch>4
replace comch=. if comch==0
histogram comch
* Recode Close to Party *
rename V401 close
replace close=. if close>2
histogram close
* Recode One-party vs Multi-party system *
rename V429 partysystem
replace partysystem=. if partysystem>2
* Recode Interest in Government *
rename V430 interestgov
replace interestgov=. if interestgov>2
* Rename Sex *
rename V578 gender
replace gender=. if gender >2
* Rename Year of Birth *
rename V579 ybirth
replace ybirth=. if ybirth == 0
* Rename Age * 
rename V580 age
replace age=. if age==0
replace age=. if age==999
* Rename Age Class  * 
rename V581 ageclass
replace ageclass=. if ageclass==0
replace ageclass=. if ageclass>8
* Rename Age Cohort  * 
rename V582 agecoh
replace agecoh=. if agecoh==0
replace agecoh=. if agecoh>5
* Recode Marital status *
rename V583 marstat
replace marstat=. if marstat==9
* Recode Religion *
rename V587 religion
replace religion=. if religion > 9
* Reode Religiosity *
rename V588 religiosity
replace religiosity=. if religiosity ==0
replace religiosity=. if religiosity >5
* Education *
rename V592 education
replace education=. if education>3
replace education=. if education==0
* Monthly Income *
rename V617 moninc
replace moninc =. if moninc >6
replace moninc=. if moninc==0
* Monthly income scale *
rename V619 monincsc
replace monincsc=. if monincsc>10
replace monincsc=. if monincsc==0
* Social Class *
rename V622 socclass
replace socclass=. if socclass>6
replace socclass=. if socclass==0
* Size of Community *
rename V632 scomm
replace scomm=. if scomm>5
* Recode in democracy problems will be solved *
rename V337 demsolv
replace demsolv=. if demsolv>3
replace demsolv=. if demsolv==0
* Recode national political situation *
rename V338 polsit
replace polsit=. if polsit>5
replace polsit=. if polsit==0
replace satdem=. if satdem > 10
histogram satdem
replace needwd=. if needwd > 2
replace ybirth=. if ybirth ==9999


tab wave
generate minority = .
replace minority = 1 if V589 != 7 & country == 2
replace minority = 1 if V589 != 16 & country == 7
replace minority = 1 if V589 != 26 & country == 11
replace minority = 1 if V589 != 25 & country == 10
replace minority = 1 if V589 != 27 & country == 12
replace minority = 1 if V589 != 33 & country == 15
replace minority = 1 if V589 != 9 & country == 3
replace minority = 1 if V589 != 30 & country == 14
replace minority = 1 if V589 != 29 & country == 13
replace minority = 1 if V589 != 19 & country == 8
replace minority = 1 if V589 != 20 & country == 9
replace minority = 1 if V589 != 10 & country == 4
replace minority = 0 if minority == .
tab V439
recode V439 (1 = 2) (2 = 1), gen(patdu)
tab V436
recode V436 (1 = 2) (2 = 1), gen(expower)




sem (support -> dembest, ) (support -> elect, ) (support -> partneed, ) (support -> needpar, ) (V417 -> support, ), latent(support ) nocapslatent
tab V417
sem (support -> dembest, ) (support -> elect, ) (support -> partneed, ) (support -> needpar, ) (V432 -> support, ), latent(support ) nocapslatent
sem (support -> dembest, ) (support -> elect, ) (support -> partneed, ) (support -> needpar, ) (V433 -> support, ), latent(support ) nocapslatent
tab V432
tab V433

